package com.xmim.core.entity;


import com.xmim.core.constants.AttrConstants;
import com.xmim.core.constants.MessageConstants;

import java.io.Serializable;
import java.util.HashMap;
import java.util.Map;

/**
 * 控制端/服务器/傀儡端 三者之间传输的对象
 */
public class HeaderBody implements Serializable, MessageConstants, AttrConstants {
    /*命令*/
    protected String code;
    /*请求头*/
    protected Map<String, Object> headers;
    /*  请求体   */
    protected Object body;

    public HeaderBody() {
        this.headers = new HashMap<>();
    }

    public String getCode() {
        return code;
    }

    public void addHeaders(String name, Object value) {
        this.headers.put(name, value);
    }

    public Map<String, Object> headers() {
        return headers;
    }

    public Object getHeaders(String name) {
        return headers.get(name);
    }

    public Object getBody() {
        return body;
    }
}
